package com.skynet.supervision.mq.consumer;

import io.netty.util.CharsetUtil;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;


@Component//message_test_topic
@RocketMQMessageListener(topic = "queue_test_topic",selectorExpression="*",consumerGroup = "test-springboot-message-group")
public class Consumer implements RocketMQListener<MessageExt> {

    @Override
    public void onMessage(MessageExt message) {
        byte[] body = message.getBody();
        String msg = new String(body, CharsetUtil.UTF_8);
        System.out.println("接收到消息======= :" + msg);

    }
}